<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:composite="http://java.sun.com/jsf/composite"
	xmlns:form_composites="http://java.sun.com/jsf/composite/form_composites"
	xmlns:p="http://primefaces.org/ui">
<h:head></h:head>

<composite:interface>
</composite:interface>

<composite:implementation>
	<h:body>
		<form_composites:searchForm beanToUse="#{dnsLdapTreeBean}"
			componentsToUpdate=":#{p:component('dnsLdapTreeView')}, :#{p:component('searchDNSText')}"
			searchIdField="searchDNSText" />
		<h:form>
			<p:contextMenu for="dnsLdapTreeView">
				<p:menuitem value="Refresh tree" nodeType="root"
					actionListener="#{dnsLdapTreeBean.refresh()}"
					update=":#{p:component('dnsLdapTreeView')}" icon="ui-icon-refresh">
				</p:menuitem>
			</p:contextMenu>
			<p:contextMenu nodeType="ldapDNSARecord" for="dnsLdapTreeView">
				<p:menuitem value="Edit A Record"
					update="#{viewBeanBucket.getUpdateString()}" icon="ui-icon-shuffle">
					<f:setPropertyActionListener value="true"
						target="#{editARecordBean.show}" />
				</p:menuitem>
				<p:menuitem value="Delete" appendToBody="true" icon="ui-icon-close"
					onclick="confirmation.show()">
				</p:menuitem>
			</p:contextMenu>
			<p:contextMenu nodeType="ldapDNSCName" for="dnsLdapTreeView">
				<p:menuitem value="Delete" appendToBody="true" icon="ui-icon-close"
					onclick="confirmation.show()">
				</p:menuitem>
			</p:contextMenu>
			<p:contextMenu for="dnsLdapTreeView" nodeType="ldapDNSZone">
				<p:menuitem value="Create A Record"
					update="#{viewBeanBucket.getUpdateString()}" icon="ui-icon-contact">
					<f:setPropertyActionListener value="true"
						target="#{createARecordBean.show}" />
				</p:menuitem>
			</p:contextMenu>
			<p:tree style="width: auto" id="dnsLdapTreeView" dynamic="true"
				selection="#{dnsLdapTreeBean.selectedNode}" selectionMode="single"
				value="#{dnsLdapTreeBean.root}" var="node">

				<p:ajax event="select" update="#{viewBeanBucket.getUpdateString()}"
					listener="#{dnsLdapTreeBean.onNodeSelect}" />
				<p:ajax event="expand" listener="#{dnsLdapTreeBean.onNodeExpand}" />

				<p:treeNode type="root" expandedIcon="ui-icon-folder-open"
					collapsedIcon="ui-icon-folder-collapsed">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="default" icon="ui-icon-document">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="ldapDNSZone" expandedIcon="ui-icon-folder-open"
					collapsedIcon="ui-icon-folder-collapsed">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="ldapDNSARecord" icon="ui-icon-contact">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
				<p:treeNode type="ldapDNSCName" icon="ui-icon-link">
					<h:outputText value="#{node.cn}" />
				</p:treeNode>
			</p:tree>
		</h:form>
	</h:body>
</composite:implementation>
</html>